import { get, post, del, patch } from "../utils/request";

// 创建文章
export const createArticle = async (body) => {
  return await post('/article', body)
}

// 分页查询文章列表
export const queryArticleList = async (queryBody) => {
  return await get('/article', queryBody)
}

// 根据ID查询文章详情
export const queryArticleDetail = async (id) => {
  return await get(`/article/${id}`)
}

// 根据ID修改文章
export const updateArticle = async (id, body) => {
  return await patch(`/article/${id}`, body)
}

// 删除文章
export const deleteArticle = async (id) => {
  return await del(`/article/${id}`)
}

// 创建专栏
export const createColumn = async (body) => {
  return await post('/specialColumn', body)
}

// 专栏列表查询-不分页
export const queryColumnList = async () => {
  return await get('/specialColumn')
}

// 专栏列表下拉项
export const columnListForSelect = async () => {
  return await get('/specialColumn/columnListForSelect')
}

// 根据ID查询专栏
export const queryColumnDetail = async (id) => {
  return await get(`/specialColumn/${id}`)
}

// 根据ID修改专栏
export const updateColumnById = async (id, body) => {
  return await patch(`/specialColumn/${id}`, body)
}

// 删除专栏
export const deleteColumnById = async (id) => {
  return await del(`/specialColumn/${id}`)
}

// 根据专栏id查询文章列表
export const queryArticleListByColumnId = async (id, queryBody) => {
  return await get(`/specialColumn/queryArticleListByColumnId/${id}`, queryBody)
}

// 查询非该专栏的文章列表
export const queryOtherArticleListByColumnId = async (id, queryBody) => {
  return await get(`/specialColumn/queryOtherArticleListByColumnId/${id}`, queryBody)
}

// 批量取消收录
export const cancelArticleInclusion = async (body) => {
  return await post('/specialColumn/cancelArticleInclusion', body)
}

// 文章批量收录
export const addArticleInclusion = async (body) => {
  return await post('/specialColumn/addArticleInclusion', body)
}
